package com.sky.controller.admin;

import com.sky.result.Result;
import com.sky.service.VisaTemplateService;
import com.sky.annotation.IgnoreToken;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/admin/visa")
@Slf4j
@Api(tags = "签证模板相关接口")
@CrossOrigin
public class VisaTemplateController {

    @Autowired
    private VisaTemplateService visaTemplateService;

    @GetMapping("/template")
    @ApiOperation("查询模板ID")
    public Result<List<Long>> getTemplateIds(@RequestParam Long productId) {
        log.info("查询模板ID, 参数: productId:{}", productId);
        List<Long> templateIds = visaTemplateService.getTemplateIdsByProductId(productId);
        return Result.success(templateIds);
    }

    @GetMapping("/template/user-types/{productId}")
    @ApiOperation("获取产品关联的模板人员类型")
    @IgnoreToken
    public Result<List<String>> getTemplateUserTypes(@PathVariable Long productId) {
        log.info("获取产品关联的模板人员类型, 参数: productId:{}", productId);
        List<String> userTypes = visaTemplateService.getTemplateUserTypesByProductId(productId);
        return Result.success(userTypes);
    }
}